import Vue from "vue";
import Vuex from "vuex";
import createPersistedState from "vuex-persistedstate";

Vue.use(Vuex);

const nav = {
  state: {
    options: [
      {
        icon: "el-icon-menu",
        name: "首页",
        to: "/index"
      },
      {
        icon: "el-icon-menu",
        name: "行政区域管理",
        to: "/district"
      },
      {
        icon: "el-icon-menu",
        name: "地图数据管理",
        to: "/map"
      },
      {
        icon: "el-icon-menu",
        name: "组织管理",
        to: "/organization"
      },
      {
        icon: "el-icon-menu",
        name: "参数管理",
        to: "/parameter"
      },
      {
        icon: "el-icon-menu",
        name: "设备管理",
        to: "/device"
      }
    ],
    activeKey: ""
  },
  mutations: {
    setActiveKey(state, key) {
      state.activeKey = key;
    }
  },
  actions: {},
  getters: {}
};

const store = new Vuex.Store({
  modules: {
    nav: nav
  },
  plugins: [
    createPersistedState({
      storage: window.sessionStorage
    })
  ]
});

export default store;
